package lk.icta.common.util;

import lk.icta.common.AppConstants;

public class TitleUtil {
    private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TitleUtil.class);


    public static String getTitle(int code, String language) {

        if (AppConstants.SINHALA.equals(language)) {
            switch (code) {
                case 0:
                    return "Mr si";
                case 1:
                    return "Miss si";
                case 2:
                    return "Mrs si";
                case 3:
                    return "Rev si";
            }
        } else if (AppConstants.TAMIL.equals(language)) {
            switch (code) {
                case 0:
                    return "Mr ta";
                case 1:
                    return "Miss ta";
                case 2:
                    return "Mrs ta";
                case 3:
                    return "Rev ta";
            }
        } else if (AppConstants.ENGLISH.equals(language)) {
            switch (code) {
                case 0:
                    return "Mr.";
                case 1:
                    return "Miss.";
                case 2:
                    return "Mrs.";
                case 3:
                    return "Rev";
            }
        } else {
            logger.error("Invalid language : {}", language);
            throw new IllegalArgumentException("Invalid language : " + language);
        }
        logger.error("Invalid title code : {}", code);
        throw new IllegalArgumentException("Invalid title code : {}");
    }
}
